package io.renren.modules.hospital.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import io.renren.modules.hospital.entity.YsEntity;
import io.renren.modules.hospital.service.YsService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 *
 *
 * @author starry
 * @email 2495646304@qq.com
 * @date 2023-11-15 15:54:22
 */
@RestController
@RequestMapping("hospital/ys")
@Api(value = "医生信息接口", tags = "医生信息接口")
public class YsController {
    @Autowired
    private YsService ysService;

    /**
     * 列表
     */
    @GetMapping("/list")
    @ApiOperation("列表")
    //@RequiresPermissions("hospital:ys:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = ysService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{ysId}")
    @ApiOperation("信息")
    //@RequiresPermissions("hospital:ys:info")
    public R info(@PathVariable("ysId") Integer ysId){
		YsEntity ys = ysService.getById(ysId);

        return R.ok().put("ys", ys);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    @ApiOperation("保存")
    //@RequiresPermissions("hospital:ys:save")
    public R save(@RequestBody YsEntity ys){
		ysService.save(ys);

        return R.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    @ApiOperation("修改")
    //@RequiresPermissions("hospital:ys:update")
    public R update(@RequestBody YsEntity ys){
		ysService.updateById(ys);

        return R.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    @ApiOperation("删除")
    //@RequiresPermissions("hospital:ys:delete")
    public R delete(@RequestBody Integer[] ysIds){
		ysService.removeByIds(Arrays.asList(ysIds));

        return R.ok();
    }

}
